package com.imooc.config;

import com.imooc.utils.OSSUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liansen
 * @create 03-22-17:37
 */
@Configuration
public class OSSConfig {

    @Value("${oss.endpoint}")
    private String endpoint;

    @Value("${oss.fileHost}")
    private String fileHost;

    @Value("${oss.bucketName}")
    private String bucketName;

    @Value("${oss.accessKeyID}")
    private String accessKeyID;

    @Value("${oss.accessKeySecret}")
    private String accessKeySecret;

    @Bean
    public OSSUtils creatOSSClient() {
        return new OSSUtils(endpoint, fileHost, bucketName, accessKeyID, accessKeySecret);
    }
}
